package com.gome.boot.config.dyn;

import com.gome.spring.compents.servlet.DynServlet;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * Dyn接口服务基础配置.
 *
 * @author baoxiufeng
 */
@Configuration
@ConditionalOnClass({DynServlet.class})
@ServletComponentScan(basePackageClasses = DynServlet.class)
public class BaseDynConfig {

    @Bean
    public ServletRegistrationBean dynServletRegistration() {
        ServletRegistrationBean registration = new ServletRegistrationBean(new DynServlet());
        registration.addUrlMappings("/dyn/admin/*");
        return registration;
    }
}
